const path = require('path')
function resolve(dir) {
    return path.join(__dirname, dir);
}
module.exports = {
    devServer: {
        proxy: {
            '/api': {
                target: 'http://127.0.0.1:2323/',
                changeOrigin: true,
                ws: true,
                pathRewrite: {
                    '^/api': ''
                }
            }
        }
    },
    chainWebpack: config => {
        // 添加别名
        config.resolve.alias
            .set('@', resolve('src'))
            .set('assets', resolve('src/assets'))
            .set('components', resolve('src/components'))
            .set('layout', resolve('src/layout'))
            .set('base', resolve('src/base'))
            .set('static', resolve('src/static'));
        config.resolve.symlinks(true); // 热更新
    }
}